home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 October: Mac OS SDK / Dev.CD Oct 00 SDK1.toast / Development Kits / Mac OS / AIAT / Headers / Index / FreqPosting.h next >
Encoding:
Text File  |  1998-04-16  |  1005 b   |  49 lines  |  [TEXT/CWIE]

  1. // FreqPosting.h
  2. //    Copyright:    © 1994 - 1998 by Apple Computer, Inc., all rights reserved.
  3.  
  4. // Struct used by TermIndex and its subclasses.
  5.  
  6. #pragma once
  7. #ifndef FreqPosting_h
  8. #define FreqPosting_h
  9.  
  10. #pragma import on
  11.  
  12. #if PRAGMA_STRUCT_ALIGN
  13.     #pragma options align=power
  14. #endif
  15.  
  16. #include "TermIndex.h"
  17.  
  18. #pragma IA_BEGIN_EXPORTS
  19.  
  20. // FreqPosting: represents an occurence of a term.
  21. struct FreqPosting {
  22.     friend class InvertedIndex;
  23. public:
  24.         FreqPosting() {}
  25.         FreqPosting(DocID i, DocLength f) : docID(i), freq(f) {}
  26.         
  27.         void SetDocID (DocID docid) {docID = docid;}
  28.         DocID GetDocID () {return docID;}
  29.         
  30.         void SetFreq (DocLength    frequency) {freq = frequency;}
  31.         DocLength GetFreq() {return freq;}
  32.         
  33. private:    
  34.     void*            operator new(size_t size);        // stack or array allocate only
  35.     DocID             docID;                // document the term occurred in
  36.     DocLength        freq;                // number of times it occurred
  37.  
  38. };
  39.  
  40. #pragma IA_END_EXPORTS
  41.  
  42. #if PRAGMA_STRUCT_ALIGN
  43.     #pragma options align=reset
  44. #endif
  45.  
  46. #pragma import reset
  47.  
  48. #endif
  49.